import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { MallOrderitemVO, MallOrderitemForm, MallOrderitemQuery } from '@/api/mall/mallOrderitem/types';

/**
 * 查询订单明细列表
 * @param query
 * @returns {*}
 */

export const listMallOrderitem = (query?: MallOrderitemQuery): AxiosPromise<MallOrderitemVO[]> => {
  return request({
    url: '/mall/mallOrderitem/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询订单明细详细
 * @param id
 */
export const getMallOrderitem = (id: string | number): AxiosPromise<MallOrderitemVO> => {
  return request({
    url: '/mall/mallOrderitem/' + id,
    method: 'get'
  });
};

/**
 * 新增订单明细
 * @param data
 */
export const addMallOrderitem = (data: MallOrderitemForm) => {
  return request({
    url: '/mall/mallOrderitem',
    method: 'post',
    data: data
  });
};

/**
 * 修改订单明细
 * @param data
 */
export const updateMallOrderitem = (data: MallOrderitemForm) => {
  return request({
    url: '/mall/mallOrderitem',
    method: 'put',
    data: data
  });
};

/**
 * 删除订单明细
 * @param id
 */
export const delMallOrderitem = (id: string | number | Array<string | number>) => {
  return request({
    url: '/mall/mallOrderitem/' + id,
    method: 'delete'
  });
};
